<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增/修改自然人信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
    <div class="Wrapper">
        <div>
            <div id="pageInTab" class="pageInTab">
                <div tabid="tabA" title="基本信息" lselected="true">
                    <form id="formSet1">
                        <div class="fieldset1 tabel_col clearFix">
                            <div class="caption">
                                <span class="title">基本信息</span>
                            </div>
                            <div class="fieldBox col_33 col_photo">
                                <div class="label">照片</div>
                                <div class="field">
                                    <img src="${mySelfImgUrlAll}" name="mySelfImgUrlAll" id="mySelfImgUrlAll"/>
                                </div>
                            </div>
                            
                            <div class="fieldBox col_33">
                                <div class="label">客户类型</div>
                                <div class="field">
                                	<span class="requiredSymbol">自然人</span>
                                    <!-- <input type="radio" value="2" name="customerTYPE" /> 企业
                                    <input type="radio" value="1" name="customerTYPE" checked /> 自然人 -->
                                </div>
                            </div>
                            <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">姓名</div>
			                    <div class="field">
			                        <input name="cstNm" id="cstNm" value="${cstNm }" type="text"  class="ui-textbox" validate="{required:true,nmcharacter:true,maxlength:20}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
                            <div class="fieldBox col_33">
			                    <div class="label">性别</div>
			                    <div class="field">
			                        <c:forEach items="${searchSelectGenderCdList }" var="kv" begin="0" step="1" varStatus="status">
			                            <c:if test="${status.index == 0}">
			                                <input type="radio" value="${kv.key }" name="genderCd" checked />${kv.value }	
			                            </c:if>
										<c:if test="${status.index != 0}">
			                                <input type="radio" value="${kv.key }" name="genderCd" />${kv.value }	
			                            </c:if>
									</c:forEach>
			                    </div>
			                </div>
			                <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">客户关系</div>
			                    <div class="field test_combo">
			                        <input name="cstRlTyp" id="cstRlTyp" type="text" ltype="combobox" placeholder="请选择"  validate="{required:true}"></input>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
                            <div class="fieldBox col_33">
			                    <div class="label">证件类型</div>
			                    <div class="field">
			                        <select name="certTypCd" id="certTypCd" data-value="${npCertTypCd }" validate="{required:true, select: true}">
			                          <c:forEach items="${searchSelectNPCertTypCdList }" var="kv" begin="0" step="1" varStatus="status">
											<c:if test="${status.index == 0}">
											     <option value="${kv.key }" checked >${kv.value }</option>
											</c:if>
											<c:if test="${status.index != 0}">
											     <option value="${kv.key }">${kv.value }</option>
											</c:if>
									  </c:forEach>
			                        </select>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
                            <div class="fieldBox col_33 col_fix_photo">
                                <div class="label">证件号</div>
                                <div class="field">
                                    <input name="certNo" id="certNo" type="text" class="ui-textbox" value="${certNo }" validate="{required:true, idcardno: true}">
                                    <span class="requiredSymbol">*</span>
                                    <span class="verifyID Hide">
                                        <a href="javascript:;" id="verifyID" pass='n' class="liger_tip" title="未验证"><i class="sqIco sqIco_8"></i></a>
                                        <!-- <span class="liger_tip" title="验证通过"><i class="sqIco sqIco_1"></i></span>
                                        <a href="javascript:;" class="liger_tip" title="验证未通过"><i class="sqIco sqIco_2"></i></a> -->
                                    </span>
                                </div>
                            </div>
                            <div class="fieldBox col_33">
			                    <div class="label">证件有效起始日期</div>
			                    <div class="field">
			                        <input name="certValidSDt" id="certValidSDt" type="text" class="ui-textbox" value="" validate="{required:true}">
									<span class="requiredSymbol">*</span>
								</div>
			                </div>
			                <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">证件有效终止日期</div>
			                    <div class="field">
			                        <input name="certValidEDt" id="certValidEDt" type="text" class="ui-textbox" value="" validate="{required:true}">
									<span class="requiredSymbol">*</span>
								</div>
			                </div>
                            <div class="fieldBox col_33">
			                    <div class="label">手机号</div>
			                    <div class="field">
			                        <input name="mp1" id="mp1" type="text" class="ui-textbox" value="" validate="{required:true,mobile: true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <%--<div class="fieldBox col_33 col_fix_photo">--%>
			                    <%--<div class="label">手机号2</div>--%>
			                    <%--<div class="field">--%>
			                        <%--<input name="mp2" id="mp2" type="text" class="ui-textbox" value="" validate="{mobile: true}">--%>
			                    <%--</div>--%>
			                <%--</div>--%>
			                <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">出生日期</div>
			                    <div class="field">
			                        <input name="birthday" id="birthday" type="text" class="ui-datepicker" value="" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33 ">
			                    <div class="label">年龄</div>
			                    <div class="field">
			                        <input name="age" id="age" disabled="disabled"  type="text" ligerui="{type:'int'}" class="ui-textbox" value="">
			                    </div>
			                </div>
                            <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">婚姻情况</div>
			                    <div class="field">
			                        <select name="marStsCd" id="marStsCd" data-value="" validate="{required:true, select: true}">
			                            <c:forEach items="${searchSelectMarStsCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <%-- <div class="fieldBox col_33">
			                    <div class="label">职业</div>
			                    <div class="field">
			                        <select name="ocpCd" id="ocpCd" data-value="" validate="{required:false, select: false}">
			                            <option value="">请选择</option>
			                            <c:forEach items="${searchSelectOcpCdlist }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                    </div>
			                </div> --%>
			                <%-- <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">职务</div>
			                    <div class="field">
			                        <select name="posCd" id="posCd" data-value="" validate="{required:false, select: false}">
			                            <option value="">请选择</option>
			                            <c:forEach items="${searchSelectPosCdlist }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                    </div>
			                </div> --%>
			                <%-- <div class="fieldBox col_33">
			                    <div class="label">职称</div>
			                    <div class="field">
			                        <select name="titCd" id="titCd" data-value="" validate="{required:false, select: false}">
			                            <option value="">请选择</option>
			                            <c:forEach items="${searchSelectTitCdlist }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                    </div>
			                </div> --%>
			                
			               <!--  <div class="fieldBox col_33">
			                    <div class="label">最高学历</div>
			                    <div class="field">
			                        <select name="highDgCd" id="highDgCd" data-value="" validate="{required:false, select: true}">
			                            <c:forEach items="${highDgCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                        <span class="requiredSymbol" id="highDgCdRequiredSymbol">*</span> 
			                    </div>
			                </div>-->
			                   <div id="cstGuarDynamicBizdiv">
			                	<%-- dynamic field --%>
			                </div>
			                <div id="cstGuar1DynamicBizdiv">
			                	<%-- dynamic field --%>
			                </div>
			                <%-- <div class="fieldBox col_33">
			                    <div class="label">居住状况</div>
			                    <div class="field">
			                        <select name="livCndCd" id="livCndCd" data-value="" validate="{required:false, select: true}">
			                            <c:forEach items="${livCndCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                        <!-- <span class="requiredSymbol" id="livCndCdRequiredSymbol">*</span> -->
			                    </div>
			                </div> --%>
			                
			               <!--  <div class="fieldBox col_33">
			                    <div class="label">电子邮箱</div>
			                    <div class="field">
			                        <input name="email" id="email" type="text" class="ui-textbox" value="" validate="{required:false,email: true}">
			                        <span class="requiredSymbol" id="emailRequiredSymbol">*</span>
			                    </div>
			                </div> -->
			                
			                <%-- <div class="fieldBox col_33">
			                    <div class="label">客户分级</div>
			                    <div class="field">
			                        <select name="cstLvlCd" id="cstLvlCd" data-value="" validate="{required:true, select: true}">
			                            <c:forEach items="${cstLvlCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                        <span class="requiredSymbol" id="cstLvlCdRequiredSymbol">*</span>
			                    </div>
			                </div> --%>
			                
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">年收入(元)</div>
			                    <div class="field">
			                        <input name="yrInc" id="yrInc" type="text" ltype='spinner' ligerui="{type:'int'}" class="ui-textbox" value="" validate="{required:false, digits:true}">
			                   		<span class="requiredSymbol">*</span>
			                    </div>
			                </div> -->
			                
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">单位地址邮编</div>
			                    <div class="field">
			                        <input name="officeZip" id="officeZip" type="text" class="ui-textbox" value="" validate="{required:false,zipcode: true}">
			                        <span class="requiredSymbol" id="officeZipRequiredSymbol">*</span>
			                    </div>
			                </div> -->
			                
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">本单位工作起始年份</div>
			                    <div class="field">
			                        <input name="workStYr" id="workStYr" type="text" readonly="readonly" class="ui-datepicker" value="" ligerui="{minView: 'decade'}" validate="{required:true}">
			                        <span class="requiredSymbol" id="workStYrRequiredSymbol">*</span>
			                    </div>
			                </div> -->
			                
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">居住地邮编</div>
			                    <div class="field">
			                        <input name="homeZip" id="homeZip" type="text" class="ui-textbox" value="" validate="{required:false,zipcode: true}">
			                        <span class="requiredSymbol" id="homeZipRequiredSymbol">*</span>
			                    </div>
			                </div> -->
			                
			                <div class="fieldBox col_33 ">
			                    <div class="label">还款方式</div>
			                    <div class="field">
			                        <select name="payTypCd" id="payTypCd" data-value="" validate="{required:false, select: false}">
			                            <option value="">请选择</option>
			                            <c:forEach items="${payTyplist }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                    </div>
			                </div>			                
			                    
			             	<!-- <div class="fieldBox col_33">
			                    <div class="label">所属行业</div>
			                    <div class="field">
			                        <input name="indCd" id="indCd" type="text" class="ui-textbox" value="" ltype="combobox" validate="{required:false, select: false}">
			                    </div>
			             	</div> -->
			             	
			             	<div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">立项控制</div>
			                    <div class="field">
			                        <select name="prjCtrlCd" id="prjCtrlCd" data-value="" validate="{required:false	, select: false}">
			                            <option value="">请选择</option>
			                            <c:forEach items="${prjCtrlCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
			                        </select>
			                    </div>
			                </div>

							<!-- 客户级别 -->
            			<ui:normalSelect pgCd="custCorpPage" cmpCd="custPageMainForm" cmpDtlCd="cstLvlCd" orgCds="${orgCds }"></ui:normalSelect>
			                <!-- <div class="fieldBox col_33">
                                <div class="label">住宅电话</div>
                                <div class="field">
                                    <input name="homeTel" id="homeTel" type="text" class="ui-textbox" value="" validate="{required:true}">
                                    <span class="requiredSymbol">*</span>
                                </div>
                            </div> -->
                            
			                <!-- <div class="fieldBox col_33">
                                <div class="label">单位电话</div>
                                <div class="field">
                                    <input name="workTel" id="workTel" type="text" class="ui-textbox" value="" validate="{required:true}">
                                    <span class="requiredSymbol">*</span>
                                </div>
                            </div> -->                            
			             	
		                 	<!-- <div class="fieldBox col_33 Hide" id="othIndCdDiv">
                                <div class="label">所属其他行业</div>
                                <div class="field">
                                    <input name="othIndCd" id="othIndCd" type="text" class="ui-textbox" value="" validate="{maxlength:50}">
                                </div>
                         	</div> -->
                         	
			                 <!-- <div class="fieldBox col_33">
			                    <div class="label">所属机构</div>
			                    <div class="field">
			                        <select name="actMgrOrgCd" id="actMgrOrgCd" data-value="" validate="{required:true, select: true}">
			                            <option value="">请选择</option>
			                            <option value="重卡事业部">重卡事业部</option>
			                        </select>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div> -->
							<div class="fieldBox col_33 col_fix_photo">
								<div class="label">是否小微企业</div>
								<div class="field">
									<select name="isSmallBusCd" id="isSmallBusCd" data-value="" validate="{required:true, select: true}" ligerui="{width: 60}">
										<option value=" " selected="selected">请选择</option>
										<option value="0">否</option>
										<option value="1">是</option>
									</select>
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 ">
								<div class="label">是否农户</div>
								<div class="field">
									<select name="isFarmer" id="isFarmer" data-value="" validate="{required:true, select: true}" ligerui="{width: 60}">
										<option value="0" selected>否</option>
										<option value="1">是</option>
									</select>
								</div>
							</div>
							<div class="fieldBox col_50 ">
								<div class="label">民族</div>
								<div class="field">
									<select name="nation" id="nation" data-value="" validate="{required:true, select: true}" ligerui="{width: 80}">
										<option value="">请选择</option>
										<c:forEach items="${searchNationCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
									</select>
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">学位</div>
								<div class="field">
									<select name="highDgCd" id="highDgCd" data-value="" validate="{required:true	, select: true}">
										<option value="">请选择</option>
										<c:forEach items="${highDgCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
									</select>
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">学历</div>
								<div class="field">
									<select name="eduLvlCd" id="eduLvlCd" data-value="" validate="{required:true}" validate="{required:true	, select: true}">
										<option value="">请选择</option>
										<c:forEach items="${eduLvlCdList }" var="kv">
											<option value="${kv.key }">${kv.value }</option>
										</c:forEach>
									</select>
									<span class="requiredSymbol">*</span>
								</div>
							</div>
                            <div class="fieldBox col_100">
			                    <div class="label">户口所在地</div>
			                    <div class="field">
			                        <input name="idAddr" id="idAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
							<div class="fieldBox col_100">
								<div class="label">现居地址</div>
								<div class="field">
									<input name="homeAddr" id="homeAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
			                <div class="fieldBox col_100">
			                    <div class="label">通讯地址</div>
			                    <div class="field">
			                        <input name="postAddr" id="postAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_100">
			                    <div class="label">备注</div>
			                    <div class="field" style="width: 100%;">
			                        <textarea name="cstRem"  id="cstRem" rows="4" class="l-textarea" style="width:99%"></textarea>
			                    </div>
			                </div>
                        </div>	
                        
                        
                        <div id="PO_formSet" class="fieldset1 tabel_col tabel_col_s clearFix">
                            <div class="caption">
                                <span class="title">配偶信息</span>
                            </div>
                            
                            <div class="fieldBox col_33 col_photo">
                                <div class="label">照片</div>
                                <div class="field">
                                    <img src="${myPeiOuImgUrlAll }" name="myPeiOuImgUrlAll" id="myPeiOuImgUrlAll"/>
                                </div>
                            </div>

                           <div class="fieldBox col_33">
			                    <div class="label">姓名</div>
			                    <div class="field">
			                        <input name="rl_rlNm" id="rl_rlNm" type="text" class="ui-textbox" value="" >
			                        <span id="rlRlNmRequiredSymbol" class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">性别</div>
			                    <div class="field">
			                        <c:forEach items="${searchSelectGenderCdList }" var="kv" begin="0" step="1" varStatus="status">
			                            <c:if test="${status.index == 0}">
			                                <input type="radio" value="${kv.key }" name="rl_genderCd" checked />${kv.value }	
			                            </c:if>
										<c:if test="${status.index != 0}">
			                                <input type="radio" value="${kv.key }" name="rl_genderCd" />${kv.value }	
			                            </c:if>
									</c:forEach>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">证件类型</div>
			                    <div class="field">
			                        <select name="rl_certTypCd" id="rl_certTypCd" data-value="" >
			                          <c:forEach items="${searchSelectNPCertTypCdList }" var="kv" begin="0" step="1" varStatus="status">
											<c:if test="${status.index == 0}">
											     <option value="${kv.key }" checked >${kv.value }</option>
											</c:if>
											<c:if test="${status.index != 0}">
											     <option value="${kv.key }">${kv.value }</option>
											</c:if>
									  </c:forEach>
			                        </select>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                
			                <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">身份证号</div>
			                    <div class="field">
			                        <input name="rl_certNo" id="rl_certNo" type="text" class="ui-textbox" value="" validate="{required:false}">
			                        <span id="rlCertNoRequiredSymbol" class="requiredSymbol">*</span>
			                        <span id="peiouVerifyID" class="poVerifyID" onclick="poVerifyId();" style="display:none">
                                        <a href="javascript:;" id="poVerifyID" pass='n' class="liger_tip" title="未验证"><i class="sqIco sqIco_8"></i></a>
                                    </span>
			                    </div>
			                </div>
			                
			                <div class="fieldBox col_33">
			                    <div class="label">出生日期</div>
			                    <div class="field">
			                        <input name="rl_birthday" id="rl_birthday" type="text" class="ui-datepicker" value="" validate="{required:false}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                
                            <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">手机号码</div>
			                    <div class="field">
			                        <input name="rl_mp" id="rl_mp" type="text" class="ui-textbox" value="" validate="{mobile: false}">
			                    	<span id="rlMpRequiredSymbol" class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">工作单位</div>
			                    <div class="field">
			                        <input name="rl_workPlc" id="rl_workPlc" type="text" class="ui-textbox" value="" validate="{maxlength:50}">
			                    </div>
			                </div>
			                 <div class="fieldBox col_33 col_fix_photo">
			                    <div class="label">单位电话</div>
			                    <div class="field">
			                        <input name="rl_tel" id="rl_tel" type="text" class="ui-textbox" value="" validate="{phone: false}">
			                    </div>
			                </div>
			                <div class="fieldBox col_100 col_fix_photo">
			                    <div class="label">户口所在地</div>
			                    <div class="field">
			                        <input name="rl_idAddr" id="rl_idAddr" type="text" class="ui-textbox" value="">
			                    	<span id="rlIdAddrRequiredSymbol" class="requiredSymbol">*</span>
			                    </div>
			                </div>
                            <div class="fieldBox col_100 col_fix_photo">
			                    <div class="label">单位地址</div>
			                    <div class="field">
			                        <input name="rl_workAddr" id="rl_workAddr" type="text" class="ui-textbox" value="" validate="{maxlength:150}">
			                    </div>
			                </div>
			                
			                <div class="fieldBox col_100">
			                    <div class="label">备注</div>
			                    <div class="field">
			                    	<textarea name="rl_rlRem" id="rl_rlRem" rows="4" class="l-textarea" style="width:99%" validate="{maxlength:150}"></textarea>
			                    </div>
			                </div>
                        </div>
                        <div class="fieldset1 tabel_col tabel_col_s clearFix">
                            <div class="caption">
                                <span class="title">辅助信息</span>
                            </div>
		                 <!-- 文化程度 -->
		                 <%-- <ui:normalSelect pgCd="custNpPage" cmpCd="custNpPageMainForm" cmpDtlCd="eduLvlCd"></ui:normalSelect> --%>
		                 <!-- 工作单位 -->
		                 <ui:normalInput pgCd="custNpPage" cmpCd="custNpPageMainForm" cmpDtlCd="workPlc"></ui:normalInput>
		                 <!-- 所属行业 -->
		                 <%-- <ui:normalSelect pgCd="custNpPage" cmpCd="custNpPageMainForm" cmpDtlCd="indCd"></ui:normalSelect> --%>
		                 <!-- 从业年限 -->
		                 <ui:normalInputDigital pgCd="custNpPage" cmpCd="custNpPageMainForm" cmpDtlCd="workYrs"></ui:normalInputDigital>
		              	 <!-- 单位地址 -->
		                 <ui:normalInput pgCd="custNpPage" cmpCd="custNpPageMainForm" cmpDtlCd="workAddr"></ui:normalInput>
		                <!-- hide data -->
		                <div class="fieldBox col_100" style="display:none;">
		                    <div class="field">
		                         <input name="cId" id="cId" onclick="" type="text" class="ui-textbox" value="${id}"/>
		                         <input name="mySelfImgUrl" id="mySelfImgUrl" type="text" class="ui-textbox" value="${mySelfImgUrl}"/>
		                         <input name="myPeiOuImgUrl" id="myPeiOuImgUrl" type="text" class="ui-textbox"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_100" id="fileModify">
							<div class="label">资料</div>
							<div class="field">
			                	<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList.jsp" flush="true" >
			                   		<jsp:param name="pkId" value="${id }"/>
			                   		<jsp:param name="tabNm" value=""/>
			                 	</jsp:include>
			            	</div>
						</div>
						<div class="fieldBox col_100">
							<div class="label">资料上传</div>
							<div class="field">
			                   	<jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload2.jsp" flush="true" >
			                   		<jsp:param name="filePath" value="customer"/>
			                   	</jsp:include>
							</div>
						</div>
                       </div>
                        <div class="btnsBox">
                            <span id="saveCustNpInfoBtn1" class="sq-button sq-button-round">保存</span>
                            <!-- <span id="openLockCustNpInfoBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_4"></i>解锁</span> -->
                        </div>
                    </form>
                    <div class="sqPanel">
                        <div class="sqPanel_head inL">
                            <div class="btnsBox inLC">
                                <span id="cst_rl_add_btn" class="sq-button sq-button-round">添加</span>
                                <span id="cst_rl_modify_btn" class="sq-button sq-button-round">修改</span>
                                <!-- <span id="cst_rl_detail_btn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_2"></i>详情</span> -->
                            </div>
                            <span>社会关系/家庭成员</span>
                        </div>
                        <div class="sqPanel_body">
                            <div id="ligergrid_A1" class="sq-grid"></div>
                        </div>
                    </div>
                </div>
                <div tabid="tabB" title="银行账号" id="tabBId" style="dis">
                    <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
                </div>
                <div tabid="tabH" title="项目列表" id="tabHId" style="dis">
                    <iframe frameborder="0" name="tabH" id="tabH" src=""></iframe>
                </div>
               <!-- 	<div tabid="tabC" title="资产信息" id="tabCId">
                    <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
                </div> -->
                <div tabid="tabD" title="征信信息" id="tabDId" style="dis">
                   <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
                </div>
                <!-- <div title="财务报表">
                    <div>财务报表</div>
                </div> -->
                <div tabid="tabF" title="中间人" id="tabFId">
                    <iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
                </div>
                 <div tabid="tabG" title="沟通记录" id="tabGId">
                    <iframe frameborder="0" name="tabG" id="tabG" src=""></iframe>
                </div>
				<div tabid="tabK" title="风险标记" id="tabKId">
					<iframe frameborder="0" name="tabK" id="tabK" src=""></iframe>
				</div>

				<div tabid="tabL" title="人工干预" id="tabLId">
					<iframe frameborder="0" name="tabL" id="tabL" src=""></iframe>
				</div>

            </div>
        </div>
    </div>
    <script>
    var pageInApp={
    		flag:true
    }; // to 下一级子窗口 接口
    var pageInTab=null;
    var loadedTabs=[]
    var npSocialRlGrid;//自然人关系Grid
    $(function() {
        initData();//初始化数据
        initEvent();//初始化事件
    });
    
  //初始化数据
    function initData(){
        initCstRlCombox();//注意*****这个初始化只能排在第一位
        //initIndCdTree();
    	initTab();
        selectTab();
    	initForm();//初始化表单
        initCstRlGrid();//初始化社会关系
        initBtn();
    	initCstInfo();//初始化客户数据
    	initFormData();//初始化默认的数据
    }
    
  	//初始化事件
    function initEvent(){
    	checkIsOrNot();
    	marStsCdEvent();
    	saveCustNpInfoBtnEvent();
    	cstRlAddBtnEvent();
    	cstRlModifyBtnEvent();
    	birthdayChangeEvnet();
    	//新增的时候在事件执行完成后在加载
    	var _id = $("#cId").val();
    	if(!_id){
    		getIdCartBirthday();
    	}
	}
  	
    function checkIsOrNot(){
    	liger.get("certTypCd").setDisabled(true);
		$("#rl_certTypCd").change(function(event) {
			if($(this).val()==0){
				$("#peiouVerifyID").show();
			}else{
				$("#peiouVerifyID").hide();
			}
		});
	}
  	
  //初始化所属行业Tree, 这个组件为动态组件, 要做存在判断
    var indCdTree;
    function initIndCdTree(){
    	if($("#indCd").length <= 0){
    		return;
    	};
    	//加载数据
    	indCdTree1 = $("#indCd").ligerComboBox({
             selectBoxWidth: 240,
             selectBoxHeight: 150,
             treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
             tree: {
            	 url: '<%=path%>/customer/cstbscinfo/initIndCdTree.do',
            	 ajaxType: 'get',
                 checkbox: false,
                 parentIcon: "none",
                 childIcon: "none",
                 onSuccess:function(){
                	 if(indCdVal){//这里和赋值方法里面都有一个赋值,因为在赋值操作和这个下拉框赋值操作是异步的,谁在前谁在后不好说,所以在两个地方根据indCdVal是否存在来赋值数据
                		 var treeselect=liger.get("indCd");
                	 	 if(treeselect){
	                       	 treeselect.setValue(indCdVal);
                	 	 }
                	 }
                	 //如果客户为新增则赋值默认值
                	var cId = $("#cId").val();
                    if(!cId){
                    	var treeselect=liger.get("indCd");
                    	if(treeselect){
                           treeselect.setValue(CustomerConstant.CST_IND_CD_JTYS);
                     	}
                    }
                 }
             },onChangeValue: function (value) {
                 /* if(value == LogUtils.LOG_CUST_SELECT_OTHER_VALUE){
                	 $("#othIndCdDiv").removeClass('Hide');
                 }else{
                	 $("#othIndCdDiv").addClass('Hide');
                 } */
             }
         });
    }
  	
    var isHaveCstRlTypeDBR = false;
  	//初始化客户关系类型下框框
    function initCstRlCombox(){
  		var cstRlTypChange = false;//只为了在加载初始化的时候不加载onChangeValue 事件,带前端解决后即可删除
    	var _cstRlTypJson = ${cstRlTypCdList};
    	var cstRlTypLCB = $("#cstRlTyp").ligerComboBox({ 
    		isShowCheckBox: true, 
    		isMultiSelect: true,
            data: _cstRlTypJson,
            valueField: 'key',
            textField:'value',
            onChangeValue :function(value){
            	if(!cstRlTypChange)return;
            	
            	var _cstRlTypObj = liger.get("cstRlTyp");
            	var _cstRlTypValues = _cstRlTypObj.getValue();
            	//alert(_cstRlTypValues);
            	var formSet1 = liger.get("formSet1");
            	//如果是担保人则加载
            	if(_cstRlTypValues.indexOf(CustomerConstant.CST_RL_TYPE_DBR_CD) != -1 && isHaveCstRlTypeDBR == false){
            		reloadCstRlTypDBR(CustomerConstant.CST_RL_TYPE_DBR_CD);
            		isHaveCstRlTypeDBR = true;
            	}else if(_cstRlTypValues.indexOf(CustomerConstant.CST_RL_TYPE_DBR_CD) == -1 && isHaveCstRlTypeDBR == true){
            		reloadCstRlTypDBR(-1);
            		isHaveCstRlTypeDBR = false;
            	}
            	
            	var marriageState_val = $("#marStsCd").val();//婚姻状况
            	
            	if(formSet1){
            		if(_cstRlTypValues == CustomerConstant.CST_RL_TYPE_DBR_CD){//只是担保人的时候
                		//担保人的时候部分字段非必填项设置：居住地邮编、单位地址邮编、居住状况、本单位工作起始年份、客户分级、最高学历、电子邮箱
                		formSet1.setFieldValidate("homeZip", {required: false});
                		$("#homeZipRequiredSymbol").hide();
                		formSet1.setFieldValidate("officeZip", {required: false});
                		$("#officeZipRequiredSymbol").hide();
                		formSet1.setFieldValidate("livCndCd", {required: false});
                		$("#livCndCdRequiredSymbol").hide();
                		formSet1.setFieldValidate("workStYr", {required: false});
                		$("#workStYrRequiredSymbol").hide();
                		formSet1.setFieldValidate("cstLvlCd", {required: false});
                		$("#cstLvlCdRequiredSymbol").hide();
                		formSet1.setFieldValidate("highDgCd", {required: false});
                		$("#highDgCdRequiredSymbol").hide();
                		formSet1.setFieldValidate("email", {required: false});
                		$("#emailRequiredSymbol").hide();
                		
                		//选择已婚状态下-担保人可以不添加配偶信息 2017-05-15
                		if (marriageState_val==CustomerConstant.CST_MAR_STS_CD_2 
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_first
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_agian
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_back
			            	) {
	                			formSet1.setFieldValidate("rl_rlNm", {required: false});
	                     		$("#rlRlNmRequiredSymbol").hide();
	                     		formSet1.setFieldValidate("rl_certNo", {required: false});
	                     		$("#rlCertNoRequiredSymbol").hide();
	                        	formSet1.setFieldValidate("rl_mp", {required: false});
	                     		$("#rlMpRequiredSymbol").hide();
	                        	formSet1.setFieldValidate("rl_idAddr", {required: false});
	                     		$("#rlIdAddrRequiredSymbol").hide();
			            }
                	}else{
                		//不是担保人的时候要必填设置:居住地邮编、单位地址邮编、居住状况、本单位工作起始年份、客户分级、最高学历、电子邮箱
                		/* formSet1.setFieldValidate("homeZip", {required: true,zipcode: true});
                		$("#homeZipRequiredSymbol").show();
                		formSet1.setFieldValidate("officeZip", {required: true,zipcode: true});
                		$("#officeZipRequiredSymbol").show();
                		formSet1.setFieldValidate("livCndCd", {required: true, select: true});
                		$("#livCndCdRequiredSymbol").show();
                		formSet1.setFieldValidate("workStYr", {required: true});
                		$("#workStYrRequiredSymbol").show();
                		formSet1.setFieldValidate("cstLvlCd", {required: true, select: true});
                		$("#cstLvlCdRequiredSymbol").show();
                		formSet1.setFieldValidate("highDgCd", {required: true, select: true});
                		$("#highDgCdRequiredSymbol").show();
                		formSet1.setFieldValidate("email", {required: true,email: true});
                		$("#emailRequiredSymbol").show(); */
                		//有客户存在的情况下必须要添加配偶信息 2017-05-15
                		if (marriageState_val==CustomerConstant.CST_MAR_STS_CD_2 
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_first
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_agian
			        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_back
			            	) {
	                			formSet1.setFieldValidate("rl_rlNm", {required: true});
	                    		$("#rlRlNmRequiredSymbol").show();
	                    		formSet1.setFieldValidate("rl_certNo", {required: true});
	                    		$("#rlCertNoRequiredSymbol").show();
	                       		formSet1.setFieldValidate("rl_mp", {required: true});
	                    		$("#rlMpRequiredSymbol").show();
	                       		formSet1.setFieldValidate("rl_idAddr", {required: true});
	                    		$("#rlIdAddrRequiredSymbol").show();
			            }
                	}
            	}
            }
        });
    	cstRlTypChange = true;
    	//这里要判断是新增的时候才赋值默认
    	var _cId = $("#cId").val();
        if(!_cId){
        	var currentCstRlTypeForAdd = ${currentCstRlTypeForAdd};
    		$("#cstRlTyp").ligerGetComboBoxManager().setValue(currentCstRlTypeForAdd);//注意变成常量
        }
     }
  	
 	//刷新担保人组件
  	function reloadCstRlTypDBR(_bizCd){
  		var _url = '<%=path%>/customer/cstbscinfo/toCstGuarDynamicPage.do';
		//如果有参数则在第二个参数中传入
		$("#cstGuarDynamicBizdiv").load(_url,{bizCd:_bizCd},function(responseText,textStatus){
			    $("#formSet1").check_ligerFormEditor();//重新刷新页面动态字段
				var form = new liger.get("formSet1");
    			form.setData({
    				guarTypCd:tempGuarTypCd,
    				guarAmt:tempGuarAmt
    			});
		});
		
		//重新赋值使用
		_url = '<%=path%>/customer/cstbscinfo/toCstDynamicPageForNp.do';
		//如果有参数则在第二个参数中传入
		$("#cstGuar1DynamicBizdiv").load(_url,{bizCd:_bizCd},function(responseText,textStatus){
			    $("#formSet1").check_ligerFormEditor();//重新刷新页面动态字段
				var form = new liger.get("formSet1");
    			form.setData({
    				schr7:tempSchr7,
    				usedNm:tempUsedNm,
    				drvLicTyp:tempDrvLicTyp,
    				nation:tempNation
    			});
		});
  	}
    var toAddFlag = '${toAddFlag}';
  	//初始化Tab
    function initTab(){
    	 pageInTab = $("#pageInTab").ligerTab({
             height: 'auto',
             contextmenu: false,
             minIframeHeight: GET_minIframeHeight(),
             onReload: function () {
                 if (toAddFlag == 'true') {
                     var _cId = $("#cId").val();
                     var _cstNm = $("#cstNm").val();
                     var params = "?cstId=" + _cId + "&cstNm=" + _cstNm;
                     pageInTab.setTabItemSrc(tabid, "<%=path%>/risk/rskCstSignLog/toListPage.do" + params);
                 }
             },
             onBeforeSelectTabItem: function (tabid) {
             	var _cId = $("#cId").val();
             	if(tabid!="tabA"&& tabid != "tabK"){
 	            	if(pageInApp.flag){
 	            		UIUtils.alertWarning(LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO);
 	                	return false;
 	                }
             	}
             },
             onAfterSelectTabItem: function(tabid) {
                 if (loadedTabs.indexOf(tabid)<0) {
                 	//获取客户ID供其它页面使用
                 	var _cId = $("#cId").val();
                 	var _cstNm = $("#cstNm").val();
                 	if(tabid!="tabA" && tabid != "tabK"){
 	                	if(!_cId){
 	                		 UIUtils.alertWarning(LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO);
 	                         return false; //验证不通过，不执行以下代码
 	                	}
                 	}
                     loadedTabs.push(tabid);
                     switch (tabid){
                         case "tabB":
                             pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpBankAccPage.do?cstId="+_cId);
                             break;
                         case "tabH":
                        	 var parms = "?cstId="+_cId+"&cstNm="+_cstNm;
                             pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstbscinfo/toCstProjectPage.do"+parms);
                             break;
                         case "tabC":
                             pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstbscinfo/toCustCstBacInfoEpAssetPage.do?cstId="+_cId);
                             break;
                         case "tabD":
                             pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstbscinfo/toCstCreditPage.do?cstId="+_cId);
                             break;
                         case "tabF":
                             pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstmidmaninfo/toListPage.do?cstId="+_cId);
                             break;
                         case "tabG":
                             pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstcommrec/toListPage.do?cstId="+_cId);
                             break;
                         case "tabK":
                             var parms = "?cstId=" + _cId + "&cstNm=" + _cstNm + "&toAddFlag=" + toAddFlag;
                             pageInTab.setTabItemSrc(tabid, "<%=path%>/risk/rskCstSignLog/toListPage.do" + parms);
                             break;
						 case "tabL":
							 var parms = "?Id=" + _cId + "&useType=1&cstType=1";
							 pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstManualRelation/toListPage.do"+parms);
							 break;
                     }
                 };
                 SetIframe_height();
             }
         });

         $.extend(true, pageInApp, {
             pageInTab: pageInTab
         });
    };
    function selectTab() {
        if (toAddFlag == 'true') {
            pageInTab.selectTabItem("tabK");
        }
    }
    //初始化社会关系
    function initCstRlGrid() {
    	var _cId = $("#cId").val();
    	$("#ligergrid_A1").ligerGrid({
        	usePager: false,
            url: '<%=path%>/customer/cstnpsocialrl/initList.do',
            delayLoad:true,
	    	method : 'get',
            columns: [{
                display: '关系',
                name: 'rlTypCdNm',
                isSort: false,
                width: 120,render: function (rowdata, rowindex, value, column) { 
                	if(StringUtils.isEmpty(value)){
                		value = "";
                	}
            		var h = '';
        		    h='<a  href="javascript:cstRlDetailBtnEvent(';
                    h+="'"+rowdata.id+"'";
                    h+=')">'+value+'</a>'
                    return h;
        		}
            }, {
                display: '姓名',
                name: 'rlNm',
                isSort: false,
                minWidth: 60,
                align:'center',render: function (rowdata, rowindex, value, column) { 
                	if(StringUtils.isEmpty(value)){
                		value = "";
                	}
            		var h = value;
            		if(StringUtils.isNotEmpty(rowdata.rlCstId)){
            			 h='<a  href="javascript:toCstDetailBtnEvent(';
                         h+="'"+rowdata.rlCstId+"'";
                         h+=')">'+value+'</a>'
            		}
                    return h;
        		}
            }, {
                display: '手机号',
                name: 'mp',
                isSort: false,
                width: 150,
            }, /* {
                display: '工作单位',
                name: 'workPlc',
                isSort: false,
                minWidth: 200
            },  */{
                display: '职位',
                name: 'pos',
                isSort: false,
                minWidth: 200
            },/*  {
                display: '单位电话',
                name: 'tel',
                isSort: false,
                minWidth: 200
            },  */{
                display: '证件类型',
                name: 'certTypCdNm',
                isSort: false,
                minWidth: 200
            }, {
                display: '证件号',
                name: 'certNo',
                isSort: false,
                minWidth: 140
            }, /* {
                display: '现居地址',
                name: 'homeAddr',
                isSort: false,
                minWidth: 140
            }, */ {
                display: '单位地址',
                name: 'workAddr',
                isSort: false,
                minWidth: 140
            },
				{
					display: '三要素检测结果',
					name: 'mpStsCdNm',
					isSort: false,
					minWidth: 140
				},
				{
					display: '活体检测结果',
					name: 'livAudStsCdNm',
					isSort: false,
					minWidth: 140
				},{
                display: '操作',
                isSort: false,
                width: 100,
                render: function (rowdata, rowindex, value){
					var h = '';
					if(rowdata.rlTypCdNm != '本人'){
						h = '<a class="sq-button-hasicon" href="javascript:deleteRow(';
						h += "'" + rowdata.id + "'";
						h += ",'ligergrid_A1'";
						h += ")\"><i class=\"sqBtnIco_7\"></i>" + LogUtils.LOG_CMM_GRID_BTN_DELETE + "</a>";
					}
					return h;
				}
            }],
            pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        isScroll: false,
	        checkbox:true,
	        rownumbers:true,
            onAfterShowData: function() {
                if (parent.mainApp) parent.mainApp.parentTab.onResize();
            }
        });
    	 npSocialRlGrid = liger.get("ligergrid_A1");
    };
    
    //初始化表单
    function initForm(){
    	$("#formSet1").ligerForm({
            validate: true,
            onAfterSetFields: function () {
                $("#PO_formSet").addClass('Hide');
            }
        });
    	$("#formSet1").check_ligerFormEditor();//重新刷新页面动态字段
    };
    
    //验证配偶身份信息
    function poVerifyId(){
		if($("#poVerifyID").attr("pass") == 'y'){
			return;
		}
        var ligerForm=liger.get("formSet1");
        var _this=this;
        var custNm = $("#rl_rlNm").val();
        var certNo = $("#rl_certNo").val();
        if(!custNm){
        	UIUtils.alertWarning(LogUtils.LOG_CUST_NAME_NOT_EMPTY);
            return; //验证不通过，不执行以下代码
        }
        var rlNmFlag = ligerForm.validator.element("#rl_rlNm");
        if(!rlNmFlag){
        	$.ligerDialog.SQalert({content: "请输入正确的姓名!", SQ_type: "warning"});
            return; //验证不通过，不执行以下代码
        }
        if(!certNo){
        	UIUtils.alertWarning(LogUtils.LOG_CUST_ID_CARD_NOT_EMPTY);
            return; //验证不通过，不执行以下代码
        }
        /* var certNoFlag = ligerForm.validator.element("#rl_certNo");
        if(!certNoFlag){
        	UIUtils.alertWarning("请输入正确的身份证号!");
            return; //验证不通过，不执行以下代码
        } */
        
        var _url = '<%=path%>/customer/cstbscinfo/validateIdCard.do';
        AjaxUtils.ajaxPost(_url, {cstNm:custNm,certNo:certNo}, function(msg){
        	if(msg.success == 1){
   				if(msg.data){
   					if(msg.data.absolutePath){
   						//把这个地址记录上,当点击的时候要随保存数据一起存储
   						$("#myPeiOuImgUrl").val(msg.data.absolutePath);
   						$("#myPeiOuImgUrlAll").attr('src',msg.data.relativePath);
   					}
   				}
   				//说明已经三方验证通过
   				UIUtils.alertSuccess(msg.info);
                $("#peiouVerifyID").html(getPOVerfiedIDHtmlPass());
                $(".liger_tip").ligerTip(); // HTML元素更新后，重新ligerTip实例化
   			 }else{//验证未通过
                 UIUtils.alertWarning(msg.info);
                 $("#myPeiOuImgUrl").attr('src',"");
   			 }
        },true);
    };
    
    //婚姻情况下拉事件
    function marStsCdEvent(){
    	$("#marStsCd").change(function(event) {
            var marriageState_val=$(this).val();
            var formSet1=liger.get("formSet1");
            //alert(marriageState_val);
            if (marriageState_val==CustomerConstant.CST_MAR_STS_CD_2 
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_first
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_agian
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_back
            	) {
                $("#PO_formSet").removeClass('Hide');
                $("#PO_formSet").ligerForm({validate: true})
                // 设置《必选》验证规则
                formSet1.setFieldValidate("rl_rlNm", {required: true, nmcharacter:true});
                formSet1.setFieldValidate("rl_certNo", {required: true});
                formSet1.setFieldValidate("rl_mp", {required: true, mobile: true});
                formSet1.setFieldValidate("rl_idAddr", {required: true});
                formSet1.setFieldValidate("rl_birthday", {required: true});
                SetIframe_height();
            }else{
                $("#PO_formSet").addClass('Hide');
                $("#PO_formSet").ligerForm({validate: false})
                // 取消《必选》验证规则
                formSet1.setFieldValidate("rl_rlNm", {required: false, nmcharacter:true});
                formSet1.setFieldValidate("rl_certNo", {required: false});
                formSet1.setFieldValidate("rl_mp", {required: false, mobile: false});
                formSet1.setFieldValidate("rl_idAddr", {required: false});
                formSet1.setFieldValidate("rl_birthday", {required: false});
            };
        });
    };
    
    //保存事件
    function saveCustNpInfoBtnEvent(){
    	$("#saveCustNpInfoBtn1").click(function(event) {
            var form = liger.get("formSet1");
            if (!form.valid()) {
            	UIUtils.alertWarning(LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO);
                return false; //验证不通过，不执行以下代码
            }
            //判断夫妻手机号是否重复-REQ-3097
            var isRepeat = checkMpIsRepeat();
            if(isRepeat == 1){
            	UIUtils.alertWarning("夫妻手机号重复，请更换号码！");
                return false; //验证不通过，不执行以下代码
            }
            add();
        });
    };
    
    //新增社会关系
    function cstRlAddBtnEvent(){
        $("#cst_rl_add_btn").click(function(event) {
        	//如果客户ID不存在是不能新增
        	var _cId = $("#cId").val();
        	if(!_cId){
        		UIUtils.alertWarning(LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO);
                return; //验证不通过，不执行以下代码
        	}
        	
            $.ligerDialog.SQopen({
                width: 800,
                height:420,
                title : '社会关系/家庭成员',
                url:'<%=path%>/customer/cstnpsocialrl/toAddPage.do?cstId='+_cId,
                // 自定义buttons的时候 不要设置 fixButtons: true
                buttons: [{
                        text: "保存",  type: 'ok', cls: 'l-dialog-btn-ok',
                        onclick: function (item, Dialog) {
                            //在子页面里绑定 frameElement.dialog.onOk = function () {}
                           if (Dialog.onOk) Dialog.onOk();
                        }
                    }, {
                        text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                        onclick: function (item, Dialog) {
                            //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                            if (Dialog.onCancel) Dialog.onCancel();
                       } 
                    }
                ]
            });
        });
    };
    
    //修改社会关系
    function cstRlModifyBtnEvent(){
    	$("#cst_rl_modify_btn").click(function(event) {
        	//如果客户ID不存在是不能修改
        	var _cId = $("#cId").val();
        	if(!_cId){
        		UIUtils.alertWarning(LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO);
                return; //验证不通过，不执行以下代码
        	}
        	
        	var selectedRows = npSocialRlGrid.getSelectedRows();
    		if(selectedRows.length != 1){
    			UIUtils.alertWarning(LogUtils.LOG_CMM_SELECT_ONLY_A_ROW);
    			return;
    		}

			if(selectedRows[0].rlTypCdNm == "本人"){
				UIUtils.alertWarning("本人数据不可操作");
				return;
			}

    		var _id = selectedRows[0].id;
        	
            $.ligerDialog.SQopen({
                width: 800,
                height:420,
                title : '社会关系/家庭成员',
                url:'<%=path%>/customer/cstnpsocialrl/toAddPage.do?cstId='+_cId+'&rId='+_id,
                // 自定义buttons的时候 不要设置 fixButtons: true
                buttons: [{
                        text: "保存", type: 'ok', cls: 'l-dialog-btn-ok', 
                        onclick: function (item, Dialog) {
                            //在子页面里绑定 frameElement.dialog.onOk = function () {}
                            if (Dialog.onOk) Dialog.onOk();
             	        }
                    }, {
                        text: "取消", type: 'cancel', cls: 'l-dialog-btn-no', 
                        onclick: function (item, Dialog) {
              	           //在子页面里绑定 frameElement.dialog.onCancel = function () {}
              	           if (Dialog.onCancel) Dialog.onCancel();
              	        }
                    }
                ]
            });
        });
    }
    
    //社会关系详细
    function cstRlDetailBtnEvent(_id){
           $.ligerDialog.SQopen({
                width: 800,
                height:420,
                title : '社会关系/家庭成员',
                url:'<%=path%>/customer/cstnpsocialrl/toDetailPage.do?rId='+_id,
             	// 自定义buttons的时候 不要设置 fixButtons: true
                buttons: [{
                        text: "关闭", type: 'cancel', cls: 'l-dialog-btn-no',
                        onclick: function (item, Dialog) {
              	           //在子页面里绑定 frameElement.dialog.onCancel = function () {}
              	           if (Dialog.onCancel) Dialog.onCancel();
              	        }
                    }
                ]
                		
           });
    }
    
    //到客户查看页面
    function toCstDetailBtnEvent(_cstId){
    	Add_navTab('tab_cst_detail'+_cstId,'客户详情','<%=path%>/customer/cstbscinfo/toCustDetailPage.do?id='+_cstId);
    }
    
    
    //如果是身份证就获取生日  15位或者 18位
    function getIdCartBirthday(){
    	var val = $("#certNo").val();
    	var npCertTypCd = "${npCertTypCd }";
    	if(!val||npCertTypCd!=0){
    		return;
    	}
    	
    	if(!RegexUtils.isIDCard(val)){
    		return;
    	}
    	
    	var year = "";
    	var month = "";
    	var day = "";
    	if(val.length == 15){//获取生日 15截取7-12, 年份+19**
    		year = "19" + val.substring(6,8);
    		month = val.substring(8,10);
    		day = val.substring(10,12);
    	}else if(val.length == 18){//获取生日 18截取7-14
    		year = val.substring(6,10);
    		month = val.substring(10,12);
    		day = val.substring(12,14);
    	}
    	$("#birthday").val(year + "-" + month + "-" + day);
    	$("#birthday").trigger("change");
    }
    
  	//生日变更事件
    function birthdayChangeEvnet(){
   	 $("#birthday").ligerDateEditor({
				format: "yyyy-MM-dd",
				labelAlign: 'center',
				//cancelable : false,
				onChangeDate:function(value){
					value = value.replace(/-/g,"/") + " 00:00:00";
					var newDateYear = new Date(value).getFullYear();
					var currentYear = new Date().getFullYear();
                    var nowMonth = new Date(value).getMonth();
                    var currentMonth = new Date().getMonth();
                    var nowDay = new Date(value).getDate();
                    var currentDate = new Date().getDate();
					var age = currentYear - newDateYear;
					if(age > 0){
					    if(currentMonth < nowMonth){
                            age = age - 1;
						}else if(currentMonth == nowMonth){
                            if(currentDate < nowDay){
                                age = age - 1;
                            }
						}
						$("#age").val(age);
					}else{
						$("#age").val(0);
					}
				}
		});
    };
    
    //初始化客户信息
    var tempData;//主要用与动态表单在加载完成后需要赋值的情况,如修改页面加载数据
    var tempGuarTypCd;
    var tempGuarAmt;
    var tempSchr7;//工作单位性质
    var tempUsedNm;
	var tempDrvLicTyp;
	var tempNation;
    function initCstInfo(){
    	var _id = $("#cId").val();
    	if(!_id){
    		return;	
    	}
    	
    	var _url = '<%=path%>/customer/cstbscinfo/getById.do';
    	AjaxUtils.ajaxGet(_url, {id:_id}, function(msg){
    		if(msg.success == 1){
				 //禁用用户名和身份证号码
				 disableVIDInfo();
				 setData(msg.data);//设置数据
				 tempData = msg.data;
				 pageInApp.flag=false;
				 reloadCstRlGrid(_id);
			 }else{
				 UIUtils.alertError(msg.info);
			 }
			 disableCustomerTYPE();
    	},true);
    }
    
    //禁用客户类型选项
    function disableCustomerTYPE(){
    	if($("[name=customerTYPE]")){//特殊情况使用
    		var obj = $("[name=customerTYPE]");
    		obj.setDisabled_ligerRadio(true);
    	};
    }
    
  	//初始化按钮
  	function initBtn(){
  		//如果是修改操作则隐藏解锁按钮
  		$("#openLockCustNpInfoBtn").hide();
  	}
	
    //设置页面数据
    var indCdVal;
    var mp1_bef = ""; //手机号1-页面初始值
    function setData(data){
		prjCtrlCd
    	var form = new liger.get("formSet1");
    	form.setData({
    		cstLvlCd:data.cstLvlCd,
    		cstStsCd:data.cstStsCd,
    		certTypCd:data.certTypCd,
    		cstCd:data.cstCd,
    		cstNm:data.cstNm,
    		cstRem:data.cstRem,
    		certNo:data.certNo,
    		othIndCd:data.othIndCd,
    		payTypCd:data.payTypCd,
			isFarmer:data.isFarmer
    	});
    	
    	//如果证件号码或者名称为空则要放开禁用功能
    	if(StringUtils.isEmpty(data.cstNm)){
    		liger.get("cstNm").setEnabled(true);
    	}
    	
		if(StringUtils.isEmpty(data.certNo)){
			liger.get("certNo").setEnabled(true);
    	}
    	
    	//我自己的身份证照片
    	if(StringUtils.isNotEmpty(data.mySelfIDImgUrl)){
	    	$("#mySelfImgUrlAll").attr('src',data.mySelfIDImgUrl); 
    	}
    	
    	//我配偶的身份证照片
    	if(StringUtils.isNotEmpty(data.myPeiOuIDImgUrl)){
    		$("#myPeiOuImgUrlAll").attr('src',data.myPeiOuIDImgUrl);
    	}
    	
    	indCdVal = data.indCd;
		 if(indCdVal){
			 var treeselect=liger.get("indCd");
			 if(treeselect){
              	 treeselect.setValue(indCdVal);
   	 	 	 }
		 }
    	
    	if(data.cstNpBscInfoVO){
    		var _workStYr = data.cstNpBscInfoVO.workStYr;
    		tempUsedNm = data.cstNpBscInfoVO.usedNm;
    		tempDrvLicTyp = data.cstNpBscInfoVO.drvLicTyp;
    		tempNation = data.cstNpBscInfoVO.nation;
    		if(StringUtils.isNotEmpty(_workStYr)){
    			_workStYr = new Date(_workStYr);
    		}
    		form.setData({
        		mp1:data.cstNpBscInfoVO.mp1,
        		mp2:data.cstNpBscInfoVO.mp2,
        		eduLvlCd:data.cstNpBscInfoVO.eduLvlCd,
        		marStsCd:data.cstNpBscInfoVO.marStsCd,
        		zipNo:data.cstNpBscInfoVO.zipNo,
        		homeTel:data.cstNpBscInfoVO.homeTel,
        		age:data.cstNpBscInfoVO.age,
        		workTel:data.cstNpBscInfoVO.workTel,
        		workPlc:data.cstNpBscInfoVO.workPlc,
        		idAddr:data.cstNpBscInfoVO.idAddr,
        		homeAddr:data.cstNpBscInfoVO.homeAddr,
        		postAddr:data.cstNpBscInfoVO.postAddr,
        		workAddr:data.cstNpBscInfoVO.workAddr,
        		workYrs:data.cstNpBscInfoVO.workYrs,
        		ocpCd:data.cstNpBscInfoVO.ocpCd,
        		posCd:data.cstNpBscInfoVO.posCd,
        		titCd:data.cstNpBscInfoVO.titCd,
        		highDgCd:data.cstNpBscInfoVO.highDgCd,
        		livCndCd:data.cstNpBscInfoVO.livCndCd,
        		cstLvlCd:data.cstNpBscInfoVO.cstLvlCd,
        		email:data.cstNpBscInfoVO.email,
        		yrInc:data.cstNpBscInfoVO.yrIncStr,
        		officeZip:data.cstNpBscInfoVO.officeZip,
        		workStYr:_workStYr,//特殊处理,必须是时间对象
        		homeZip:data.cstNpBscInfoVO.homeZip,
        		usedNm:data.cstNpBscInfoVO.usedNm,
        		drvLicTyp:data.cstNpBscInfoVO.drvLicTyp,
        		nation:data.cstNpBscInfoVO.nation,
        		certValidSDt:data.cstNpBscInfoVO.certValidSDt,
        		certValidEDt:data.cstNpBscInfoVO.certValidEDt,
        		homeTel:data.cstNpBscInfoVO.homeTel,
        		workTel:data.cstNpBscInfoVO.workTel,
			   isSmallBusCd:data.cstNpBscInfoVO.isSmallBus,
				//isFarmer:data.cstNpBscInfoVO.isFarmer
		});
    		
    		$("input[name='genderCd'][value="+data.cstNpBscInfoVO.genderCd+"]").prev(".l-radio").click();
        	if(data.cstNpBscInfoVO.birthday){
        		var date = new Date(data.cstNpBscInfoVO.birthday);
        		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        		//alert(data.cstNpBscInfoVO.birthday);
        		$("#birthday").val(dateStr);
        		dateStr = dateStr.replace(/-/g,"/") + " 00:00:00";
    			var newDateYear = new Date(dateStr).getFullYear();
    			var currentYear = new Date().getFullYear();
                var nowMonth = new Date(dateStr).getMonth();
                var currentMonth = new Date().getMonth();
                var nowDay = new Date(dateStr).getDate();
                var currentDate = new Date().getDate();
                var age = currentYear - newDateYear;
                if(age > 0){
                    if(currentMonth < nowMonth){
                        age = age - 1;
                    }else if(currentMonth == nowMonth){
                        if(currentDate < nowDay){
                            age = age - 1;
                        }
                    }
    				$("#age").val(age);
    			}else{
    				$("#age").val(0);
    			}
        	}	
    		
        	//显示配偶信息
        	if(data.cstNpBscInfoVO.cstNpSocialRlVO){
            	form.setData({
            		rl_rlNm:data.cstNpBscInfoVO.cstNpSocialRlVO.rlNm,
            		rl_certTypCd:data.cstNpBscInfoVO.cstNpSocialRlVO.certTypCd,
            		rl_certNo:data.cstNpBscInfoVO.cstNpSocialRlVO.certNo,
            		rl_mp:data.cstNpBscInfoVO.cstNpSocialRlVO.mp,
            		rl_workPlc:data.cstNpBscInfoVO.cstNpSocialRlVO.workPlc,
            		rl_tel:data.cstNpBscInfoVO.cstNpSocialRlVO.tel,
            		rl_idAddr:data.cstNpBscInfoVO.cstNpSocialRlVO.idAddr,
            		rl_workAddr:data.cstNpBscInfoVO.cstNpSocialRlVO.workAddr,
            		rl_rlRem:data.cstNpBscInfoVO.cstNpSocialRlVO.rlRem,
            		rl_birthday:data.cstNpBscInfoVO.cstNpSocialRlVO.birthday
            	});
            	//性别单独赋值
            	$("input[name='rl_genderCd'][value="+data.cstNpBscInfoVO.cstNpSocialRlVO.genderCd+"]").prev(".l-radio").click();
        	}
        	
        	var formSet1=liger.get("formSet1");
        	var marriageState_val = data.cstNpBscInfoVO.marStsCd
        	if (marriageState_val==CustomerConstant.CST_MAR_STS_CD_2 
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_first
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_agian
        			|| marriageState_val==CustomerConstant.CST_MAR_STS_CD_back
        		) {
        		 $("#PO_formSet").removeClass('Hide');
        		 formSet1.setFieldValidate("rl_rlNm", {required: true, nmcharacter:true});
                 formSet1.setFieldValidate("rl_certNo", {required: true});
                 formSet1.setFieldValidate("rl_mp", {required: true, mobile: true});
                 formSet1.setFieldValidate("rl_idAddr", {required: true});
        	}else{
        		 formSet1.setFieldValidate("rl_rlNm", {required: false, nmcharacter:false});
                 formSet1.setFieldValidate("rl_certNo", {required: false});
                 formSet1.setFieldValidate("rl_mp", {required: false, mobile: false});
                 formSet1.setFieldValidate("rl_idAddr", {required: false});
        	}
    	}else{
    		getIdCartBirthday();
    	}
    	
    	$("#cstRlTyp").ligerGetComboBoxManager().setValue(data.cstRlAttr);
    	if(data.cstRlAttrVOList){
    		form.setData({
    			prjCtrlCd:data.prjCtrlCd
        	});
    	}
    	
    	//辅助信息
    	if(data.cstExtInfoVO){
    		tempGuarTypCd = data.cstExtInfoVO.schr6;
    		tempGuarAmt = data.cstExtInfoVO.num9;//1.0E11
    		tempGuarAmt = NumberUtils.isScientificNotationToString(tempGuarAmt);
    		tempSchr7 = data.cstExtInfoVO.schr7;
    		form.setData({
    			ext_schr1:data.cstExtInfoVO.schr1,
    			ext_schr2:data.cstExtInfoVO.schr2,
    			ext_schr3:data.cstExtInfoVO.schr3,
    			ext_schr4:data.cstExtInfoVO.schr4,
    			ext_schr5:data.cstExtInfoVO.schr5,
    			ext_schr6:data.cstExtInfoVO.schr6,
    			schr7:data.cstExtInfoVO.schr7,
    			ext_mchr1:data.cstExtInfoVO.mchr1,
    			ext_mchr2:data.cstExtInfoVO.mchr2,
    			ext_mchr4:data.cstExtInfoVO.mchr4,
    			ext_mchr5:data.cstExtInfoVO.mchr5,
    			ext_mchr6:data.cstExtInfoVO.mchr6,
    			ext_mchr7:data.cstExtInfoVO.mchr7,
    			ext_mchr8:data.cstExtInfoVO.mchr8,
    			ext_bchr1:data.cstExtInfoVO.bchr1,
    			ext_bchr2:data.cstExtInfoVO.bchr2,
    			ext_num1:data.cstExtInfoVO.num1,
    			ext_num2:data.cstExtInfoVO.num2,
    			ext_num3:data.cstExtInfoVO.num3,
    			ext_num4:data.cstExtInfoVO.num4,
    			ext_num5:data.cstExtInfoVO.num5,
    			ext_num6:data.cstExtInfoVO.num6,
    			ext_num7:data.cstExtInfoVO.num7,
    			ext_num8:data.cstExtInfoVO.num8,
    			ext_num9:data.cstExtInfoVO.num9
        	});
    	}
    	
    	//设置手机号1不可修改-REQ-3424
    	var _id = $("#cId").val();
    	mp1_bef = liger.get("mp1").getValue();
    	if(_id && mp1_bef){ //修改且手机号1不为空
   			liger.get("mp1").setDisabled(true);
    	}
    }

    //新增
    var isAdd = false;//是否新增完成
    function add(){
    	var form = new liger.get("formSet1");
        var data = form.getData();
        var flag = checkDateFormat();
        if(flag != 1){
        	return ;
        }
        var genderCd = $('input[name="genderCd"]:checked ').val();
        data["genderCd"] = genderCd;
        data["birthday"] = $("#birthday").val();
        //配偶信息
        var rl_genderCd = $('input[name="rl_genderCd"]:checked ').val();
        data["rl_genderCd"] = rl_genderCd;
        var url = '<%=path%>/customer/cstbscinfo/addNp.do';
        var id = $("#cId").val();
        if(id != ""){ //修改
        	url = '<%=path%>/customer/cstbscinfo/modifyNp.do';
        	data["id"]= id;
        }else{ //新增
        	//如果添加了配偶则必须要验证后才能进行保存操作
        	/* var pass = $("#verifyID").attr("pass");
        	if(pass == 'n'){
        		$.ligerDialog.SQalert({content: LogUtils.LOG_CUST_ID_CARD_VALID_NO_PASS,SQ_type: "warning"});
        		return;
        	} */
        }
        
        var docArray = JSON.stringify(getUploadResultParams());
        
        //赋值附件
        data["docArray"] = docArray;
		//请求
        AjaxUtils.ajaxPost(url, data, function(msg){
        	if(msg.success == 1){
				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
				 if(msg.data){
					 $("#cId").val(msg.data);
					 reloadCstRlGrid(msg.data);
					 //成功后要禁用姓名和身份证号码
					 disableVIDInfo();
					 pageInApp.flag = false;
					 isAdd = true;
					 //刷新附件页面GRID方法和清空上传按钮
					 refreshUlFileRecListByPkId(msg.data,"CST_BSC_INFO");
					 clearUploadResultParams();
				 }
			 }else{
				 UIUtils.alertError(msg.info);
			 }
        }, true);
    }
    
    function checkDateFormat(){
    	var flag = 0;
    	var params = {};
    	params["certValidSDt"] = $("#certValidSDt").val();
    	params["certValidEDt"] = $("#certValidEDt").val();
    	$.ajax({
    		type:'get',
    		dataType:'json',
    		async:false,
    		url:'<%=path%>/customer/cstbscinfo/checkCertValid.do',
    		data:params,
    		success:function(data){
    			//$.ligerDialog.SQalert({content: data.info,SQ_type: "success"});	
    			if(data.success == 1){
    				flag = 1;
    			}else{
    				UIUtils.alertError(data.info);
    			}
    		},
    		error:function(data){
    			UIUtils.alertError(data.info);
    		}
    	});
    	return flag;
    }
    
    //删除客户关系
    function deleteRow(rlId, gridId) {
    	var cId = $("#cId").val();
    	if(!cId){
    		UIUtils.alertWarning(LogUtils.LOG_CUST_ID_NOT_EMPTY);
    		return;
    	}
    	
    	$.ligerDialog.SQconfirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
			if(flag == false)return;

			var _url = "<%=path%>/customer/cstnpsocialrl/removeById.do";
			AjaxUtils.ajaxPost(_url, {id:rlId}, function(msg){
				 if(msg.success == 1){
	     				$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
	     				reloadCstRlGrid(cId);
	     	 	 }else{
	     				$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	     		 }
			},true);
		});
    }
    
    //初始化表单中默认显示数据-只有新增会有默认值赋值
    function initFormData(){
    	var cId = $("#cId").val();
    	if(cId){
    		return;
    	}
    	var form = new liger.get("formSet1");
    	form.setData({
    		prjCtrlCd:CustomerConstant.CST_PRJ_CTRL_CD_NO_CTRL,
    		payTypCd:CustomerConstant.CST_PAY_TYP_CD_ONLY_APP
    	});
    }
    
    //禁用重要的信息
    function disableVIDInfo(){
    	liger.get("cstNm").setDisabled(true);
    	liger.get("certTypCd").setDisabled(true);
    	liger.get("certNo").setDisabled(true);
    	//禁用手机号1
    	var mp1 = liger.get("mp1").getValue();
		if(mp1){ //不为空
			liger.get("mp1").setDisabled(true);
		}
    }
    
    //验证身份通过-配偶
    function getPOVerfiedIDHtmlPass(){
    	var html="<span class='liger_tip' id='poVerifyID' pass='y' title='"+LogUtils.LOG_CMM_VALID_PASS+"'><i class='sqIco sqIco_1'></i></span>";
    	return html;
    }
    
    //加载客户关系数据
    function reloadCstRlGrid(_cstId){
    	 npSocialRlGrid.setParm("cstId",_cstId);
		 npSocialRlGrid.reload();
    }
    
	//判断承租人手机号与其配偶手机号是否相同
    function checkMpIsRepeat(){
	    var isRepeat = 0;//不相同
    	var mp1 = $("#mp1").val();//承租人手机号
    	var rl_mp = $("#rl_mp").val();//配偶手机号
    	if(mp1 == rl_mp){
    		isRepeat = 1;//相同
    	}
    	return isRepeat;
    }
    
    </script>
</body>
</html>